package com.xls.aclservice.mapper;

import com.xls.aclservice.entity.SysUser;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xls
 * @since 2021-03-23
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("SELECT\n" +
            "\tid,\n" +
            "\tusername,\n" +
            //"\t password,\n" +
            "\tname,\n" +
            "\tgender,\n" +
            "\tphone,\n" +
            "\tavatar,\n" +
            "\tstatus,\n" +
            "\tgmt_create,\n" +
            "\tgmt_modified,\n" +
            "\tis_deleted AS deleted\n" +
            "FROM\n" +
            "\t`sys_user` ${ew.customSqlSegment}")
    Page<SysUser> getUserPage(Page<SysUser> page, @Param(Constants.WRAPPER) QueryWrapper<SysUser> wrapper);

    SysUser getUser(Long id);
}
